# 正向索引
s='helloworld'
for i in range(0,len(s)):
    print('索引',i,end='\t')
    print('索引对应元素',s[i])
print()
# 反向索引
for i in range(-len(s),0):
    print('索引', i, end='\t')
    print('索引对应元素', s[i])
print()
# 序列的切片操作
# 序列[s:n:a]；s表示序列切片开始索引，n结束索引，a表示步长
s1=s[0:5:2]
s2=s[:5:]
s3=s[0:5:1]
s4=s[:5:1]
s5=s[0::1]
s6=s[5::]
s7=s[5:]
s8=s[::2]
s9=s[::]
s10=s[::-1]
print(s1)
print(s2)
print(s3)
print(s4)
print(s5)
print(s6)
print(s7)
print(s8)
print(s9)
print(s10)
